﻿<Page x:Class="Axiom.Hermetica.WPF.Views.Windows.SingleEditorPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
		xmlns:componentmodel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
		xmlns:mvvm="clr-namespace:Axiom.Hermetica.WPF.ViewModels"
		xmlns:sampledata="clr-namespace:Axiom.Hermetica.WPF.SampleData"
		xmlns:converters="clr-namespace:Axiom.Hermetica.WPF.Converters"
        d:DataContext="{Binding Source={StaticResource SampleData}}"
        mc:Ignorable="d" 
		FontFamily="Calibri"
	  Background="White"
        Title="SingleItemEditor" d:DesignWidth="549" d:DesignHeight="255">
	<Page.Resources>
		<ObjectDataProvider x:Key="Model" ObjectType="{x:Type mvvm:ViewModelLocator}" MethodName="GetMainViewModel"/>
		<sampledata:SampleData x:Key="SampleData"/>
		<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
		<converters:NullToDefaultImage x:Key="NullToDefaultImage"/>
	</Page.Resources>
	<Page.DataContext>
		<Binding Source="{StaticResource Model}"/>
	</Page.DataContext>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="210"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="auto"/>
			</Grid.ColumnDefinitions>
			<StackPanel DataContext="{Binding SelectedItem}">
				<StackPanel.Resources>
					<Style TargetType="{x:Type TextBlock}">
						<Setter Property="Foreground" Value="Gray"/>
						<Setter Property="FontSize" Value="12"/>
					</Style>
					<Style TargetType="{x:Type TextBox}">
						<Setter Property="Background" Value="#FAFAFA"/>
						<Setter Property="BorderBrush" Value="#CCC"/>
						<Setter Property="Foreground" Value="Black"/>
						<Setter Property="FontSize" Value="12"/>
					</Style>
				</StackPanel.Resources>
				<Grid Margin="1" Background="{StaticResource ControlBackground}">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<Grid.ContextMenu>
						<ContextMenu>
							<MenuItem Header="Pascal To Title Case" Click="MenuItem_Click_1"/>
						</ContextMenu>
					</Grid.ContextMenu>
					<TextBlock Text="Title" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"/>
					<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Author" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" />
					<TextBox Text="{Binding Author, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Subject" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" />
					<TextBox Text="{Binding Subject, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Keywords" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" />
					<TextBox Text="{Binding Keywords, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Category" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0" />
					<TextBox Text="{Binding Category, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Path" HorizontalAlignment="Right" Margin="0,0,10,0"/>
					<TextBox Text="{Binding Path}" Grid.Column="1" Height="22" VerticalAlignment="Top" IsReadOnly="True"/>
				</Grid>
				<Grid Margin="1">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="120" />
						<ColumnDefinition Width="*" />
					</Grid.ColumnDefinitions>
					<TextBlock Text="Metadata" HorizontalAlignment="Right" Margin="0,0,10,0"/>
					<TextBox Text="{Binding Metadata, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Height="52" VerticalAlignment="Top" AcceptsReturn="True"/>
				</Grid>
			</StackPanel>
			<Border Grid.Column="1" Margin="10">
				<Border.Effect>
					<DropShadowEffect BlurRadius="5" Color="Black"/>
				</Border.Effect>
				<Image Source="{Binding SelectedItem.Image}" Width="150" Stretch="Uniform"/>
			</Border>
		</Grid>
		<ListBox Grid.Row="1" 
				 BorderThickness="0"
				 Margin="5"
				 ItemsSource="{Binding AvailableThumbnails}"
				 ScrollViewer.HorizontalScrollBarVisibility="Disabled"                 
				 ScrollViewer.VerticalScrollBarVisibility="Auto"      
				 ScrollViewer.CanContentScroll="False"
				 SelectedItem="{Binding SelectedImage}"
				 VirtualizingStackPanel.VirtualizationMode="Standard"  >
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Image Source="{Binding}" Width="156" Height="156" MouseUp="OnImageMouseDown"/>
				</DataTemplate>
			</ListBox.ItemTemplate>
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<WrapPanel IsItemsHost="True"/>
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
		</ListBox>
	</Grid>
</Page>
